package com.kezesong.leasing.controller.admin;

import com.alibaba.fastjson.JSON;
import com.kezesong.leasing.common.Constant;
import com.kezesong.leasing.common.CookieUtils;
import com.kezesong.leasing.common.ResponseResult;
import com.kezesong.leasing.controller.BaseController;
import com.kezesong.leasing.controller.request.AddMsgInfoReqBody;
import com.kezesong.leasing.controller.request.UserMsgInfoReq;
import com.kezesong.leasing.entity.MsgInfoEntity;
import com.kezesong.leasing.entity.UserInfoEntity;
import com.kezesong.leasing.service.MsgInfoService;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


@RestController
@RequestMapping("/admin")
public class MsgInfoManagerController extends BaseController {

    @Autowired
    MsgInfoService msgInfoService;

    @PostMapping("/addUserMsgInfo.do")
    @ApiOperation(value = "addUserMsgInfo.do", notes = "管理员添加用户的消息")
    public ResponseResult<Integer> addUserMsgInfo(@RequestBody AddMsgInfoReqBody requestBody, HttpServletRequest request){
        MsgInfoEntity msgInfoEntity = new MsgInfoEntity();
        BeanUtils.copyProperties(requestBody, msgInfoEntity);
        int result = msgInfoService.addMsgInfo(msgInfoEntity);
        ResponseResult<Integer> integerResponseResult = buildSucessResponse(result);
        return integerResponseResult;
    }
}
